package maps

type Map[K comparable, V any] map[K]V

func NewMap[K comparable, V comparable]() Map[K, V] {
	return Map[K, V]{}
}

func (m Map[K, V]) Get(k K) (v V, ok bool) {
	return Get(m, k)
}

func (m Map[K, V]) Set(k K, v V) {
	Set(m, k, v)
}

func (m Map[K, V]) Delete(ks ...K) {
	Delete(m, ks...)
}

func (m Map[K, V]) DeleteFunc(f func(k K, v V) (deleted, continued bool)) {
	DeleteFunc(m, f)
}

func (m Map[K, V]) Exists(k K) (ok bool) {
	return Exists(m, k)
}

func (m Map[K, V]) All(ks ...K) bool {
	return All(m, ks...)
}

func (m Map[K, V]) Each(f func(k K, v V) (continued bool)) {
	Each(m, f)
}

func (m Map[K, V]) Len() int {
	return len(m)
}

func (m Map[K, V]) Clear() {
	Clear(m)
}

//func (m Map[K, V]) Equal(other Map[K, V]) bool {
//	return Equal(m, other)
//}

func (m Map[K, V]) EqualFunc(other Map[K, V], f func(v1 V, v2 V) bool) bool {
	return EqualFunc(m, other, f)
}

func (m Map[K, V]) Clone() Map[K, V] {
	return Clone(m)
}

func (m Map[K, V]) Copy(dest Map[K, V]) {
	Copy(m, dest)
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

type ComparableMap[K comparable, V comparable] map[K]V

func NewComparableMap[K comparable, V comparable]() ComparableMap[K, V] {
	return ComparableMap[K, V]{}
}

func (m ComparableMap[K, V]) Get(k K) (v V, ok bool) {
	return Get(m, k)
}

func (m ComparableMap[K, V]) Set(k K, v V) {
	Set(m, k, v)
}

func (m ComparableMap[K, V]) Delete(ks ...K) {
	Delete(m, ks...)
}

func (m ComparableMap[K, V]) DeleteFunc(f func(k K, v V) (deleted, continued bool)) {
	DeleteFunc(m, f)
}

func (m ComparableMap[K, V]) Exists(k K) (ok bool) {
	return Exists(m, k)
}

func (m ComparableMap[K, V]) All(ks ...K) bool {
	return All(m, ks...)
}

func (m ComparableMap[K, V]) Each(f func(k K, v V) (continued bool)) {
	Each(m, f)
}

func (m ComparableMap[K, V]) Len() int {
	return len(m)
}

func (m ComparableMap[K, V]) Clear() {
	Clear(m)
}

func (m ComparableMap[K, V]) Equal(other ComparableMap[K, V]) bool {
	return Equal(m, other)
}

func (m ComparableMap[K, V]) EqualFunc(other ComparableMap[K, V], f func(v1 V, v2 V) bool) bool {
	return EqualFunc(m, other, f)
}

func (m ComparableMap[K, V]) Clone() ComparableMap[K, V] {
	return Clone(m)
}

func (m ComparableMap[K, V]) Copy(dest ComparableMap[K, V]) {
	Copy(m, dest)
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

type PtrMap[K comparable, V any] map[K]*V

func NewPtrMap[K comparable, V any]() PtrMap[K, V] {
	return PtrMap[K, V]{}
}

func (m PtrMap[K, V]) Get(k K) (v *V) {
	return GetPtr(m, k)
}

func (m PtrMap[K, V]) Set(k K, v *V) {
	SetPtr(m, k, v)
}

func (m PtrMap[K, V]) Add(k K) *V {
	var v V
	SetPtr(m, k, &v)
	return &v
}

func (m PtrMap[K, V]) Delete(ks ...K) {
	Delete(m, ks...)
}

func (m PtrMap[K, V]) DeleteFunc(f func(k K, v *V) (deleted, continued bool)) {
	DeleteFunc(m, f)
}

func (m PtrMap[K, V]) Exists(k K) (ok bool) {
	return Exists(m, k)
}

func (m PtrMap[K, V]) All(ks ...K) bool {
	return All(m, ks...)
}

func (m PtrMap[K, V]) Each(f func(k K, v *V) (continued bool)) {
	Each(m, f)
}

func (m PtrMap[K, V]) Len() int {
	return len(m)
}

func (m PtrMap[K, V]) Clear() {
	Clear(m)
}

func (m PtrMap[K, V]) EqualFunc(other PtrMap[K, V], f func(v1 *V, v2 *V) bool) bool {
	return EqualFunc(m, other, f)
}

func (m PtrMap[K, V]) Clone() PtrMap[K, V] {
	return Clone(m)
}

func (m PtrMap[K, V]) Copy(dest PtrMap[K, V]) {
	Copy(m, dest)
}
